//
//  EMNetClient.h
//  EasyMoney
//
//  Created by zh on 2019/12/14.
//  Copyright © 2019 zh. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <AFNetworking.h>

NS_ASSUME_NONNULL_BEGIN

static NSString *NetClientRefreshTokenInvalid = @"NetClientRefreshTokenInvalid";

@interface EMNetClient : NSObject

@property (nonatomic, strong) AFHTTPSessionManager* netManager;
//超时时间
@property (nonatomic, assign) NSTimeInterval timeout;

+ (instancetype)sharedClient;

- (void)requestWithMethodKey:(NSString*)methodKey isPost:(BOOL)isPost param:(id)param success:(void(^)(id responseObject, NSString* message))success failed:(void(^)(NSInteger errorCode, NSString* errorMessage, id errorData))failed;

- (void)uploadWithMethodKey:(NSString*)methodKey constructBlock:(void (^)(id <AFMultipartFormData> formData))constructBlock param:(id)param progress:(void(^)(NSProgress *))progress success:(void(^)(id responseObject, NSString* message))success failed:(void(^)(NSInteger errorCode, NSString* errorMessage, id errorData))failed;

//内部方法
- (void)_requestWithMethodKey:(NSString*)methodKey isPost:(BOOL)isPost param:(id)param success:(void(^)(id responseObject, NSString* message))success failed:(void(^)(NSInteger errorCode, NSString* errorMessage, id errorData))failed;

@end

NS_ASSUME_NONNULL_END
